#include <stdio.h>
#include <stdlib.h>

#define BUFFSIZE (1024)

void usage(void) { printf("Usage:...\n"); }

int main(int argc, char **argv) {
    if(argc != 3){ fprintf(stderr, "argc != 3\n"); usage(); exit(1); }

    FILE *fps = fopen(argv[1], "r");
    if(fps == NULL){ perror("fopen()"); exit(1); }

    FILE *fpd = fopen(argv[2], "w");
    if(fpd == NULL){
        perror("fopen()");
        fclose(fps); // 关掉
        exit(1);
    }

    int n = 0;
    char buff[BUFFSIZE] = {0};
    while(1){
        if((n = fread(buff, 1, BUFFSIZE, fps)) <= 0){
            break;
        }
        fwrite(buff, 1, n, fpd);
    }

    fclose(fpd);
    fclose(fps);
    exit(0);
}
